<html>

<head>
<meta charset="UTF-8">
<title>通知管理</title>
</head>
<body>
	<#import "/page.ftl" as page />
	<link rel="stylesheet" type="text/css" href="/css/form.css">
	<script src="/js/announce.js"></script>
	<#include "/head.ftl"/>
	<div class="content">
		<div class="tab">
			<div class="tab-header">
				<a href="/announce/form" title="发布通知" class="btn btn-setting btn-add" id="add"> <i class="iconfont icon-add"
					style="font-size: 16px;"></i>
				</a>
				<a title="刷新" class="btn btn-setting" onclick="refresh(this)">
					<i class="iconfont icon-refresh"></i>
				</a>
				<form class="tab-tool" method="get" id="search">
					<input name="key" type="text" placeholder="按关键字查找...">
					<button class="search-btn">
						<i class="iconfont icon-search"></i>
					</button>
				</form>
			</div>
			<div class="tab-content">
				<div>
					<table style="width: 100%; border-collapse: collapse;">
						<tr>
							<#assign sort=announces.sort?replace(': ',',') />
							<th>类型</th>
							<th>标题</th>
							<th>状态
								<#if sort=='status,DESC'>
									<a onclick="pageSort('${requestURI}','status')"><i class="iconfont icon-arrowdown"></i></a>
								<#elseif sort=='status,ASC' >
									<a onclick="pageSort('${requestURI}','status,desc')"><i class="iconfont icon-arrowup"></i></a>
								<#else>
									<a onclick="pageSort('${requestURI}','status')"><i class="iconfont icon-arrowdown"></i></a>
								</#if>
							</th>
							<th>发布时间
								<#if sort=='time,DESC'>
									<a onclick="pageSort('${requestURI}','time')"><i class="iconfont icon-arrowdown"></i></a>
								<#elseif sort=='time,ASC' >
									<a onclick="pageSort('${requestURI}','time,desc')"><i class="iconfont icon-arrowup"></i></a>
								<#else>
									<a onclick="pageSort('${requestURI}','time')"><i class="iconfont icon-arrowdown"></i></a>
								</#if>
							</th>
							<th>发布人</th>
							<th>操作</th>
						</tr>
						<#if announces.content?size gt 0>
							<#list (announces.content) as announce>
								<tr data-id="${announce.id}">
									<td>
										<#list types['announce'] as ta>
											<#if ta.value==announce.type><span class="label" style="color: ${ta.color}">[${ta.name}]</span></#if>
										</#list>
									</td>
									<td>${announce.title}</td>
									<td>
										<#list status['announce'] as sa>
											<#if sa.value==announce.status><span class="label" style="background-color: ${sa.color}">${sa.name}</span></#if>
										</#list>
									</td>
									<td>${announce.time}</td>
									<td>${announce.user.realName}</td>
									<td>
										<a onclick="showAnnounce(this)" title="查看详情" class="btn btn-look"><i class="iconfont icon-search"></i><span> 查看详情</span></a>
										<div style="padding:10px;display: none;">
											<h2>${announce.title}</h2>
											<span style="color:#999;font-size:12px;">${announce.user.realName} 于 ${announce.time} 发布<br>
											<#if announce.announceUsers?size gt 0>
												接收者：<#list announce.announceUsers as auser>[${auser.user.realName}]</#list>
											</#if>
											</span>
											<hr>
											<p style="margin:10px 0px;">${announce.content}</p>
										</div>
										<a href="/announce/form?id=${announce.id}" title="修改审批" class="btn btn-update"><i class="iconfont icon-brush"></i><span> 修改</span></a>
										<a onclick="deleteOne(${announce.id},'/announce/delete')" class="btn btn-delete"><i class="iconfont icon-trash"></i><span> 删除</span></a>
									</td>
								</tr>
							</#list>
						<#else>
							<tr><td colspan="6">暂时没有新公告或通知~ </tr>
						</#if>
					</table>
				</div>
			</div>
			<@page.page url=requestURI pager=announces/>
		</div>
	</div>
</body>
</html>